import Mock from 'mockjs'

const tableData = [{
  id: '12987122',
  name: '好滋好味鸡蛋仔',
  category: '江浙小吃、小吃零食',
  desc: '荷兰优质淡奶，奶香浓而不腻',
  address: '上海市普陀区真北路',
  shop: '王小虎夫妻店',
  shopId: '10333'
}, {
  id: '12987123',
  name: '好滋好味鸡蛋仔',
  category: '江浙小吃、小吃零食',
  desc: '荷兰优质淡奶，奶香浓而不腻',
  address: '上海市普陀区真北路',
  shop: '王小虎夫妻店',
  shopId: '10333'
}, {
  id: '12987125',
  name: '好滋好味鸡蛋仔',
  category: '江浙小吃、小吃零食',
  desc: '荷兰优质淡奶，奶香浓而不腻',
  address: '上海市普陀区真北路',
  shop: '王小虎夫妻店',
  shopId: '10333'
}, {
  id: '12987126',
  name: '好滋好味鸡蛋仔',
  category: '江浙小吃、小吃零食',
  desc: '荷兰优质淡奶，奶香浓而不腻',
  address: '上海市普陀区真北路',
  shop: '王小虎夫妻店',
  shopId: '10333'
}
]

export default [
  // mock get all routes form server
  {
    url: '/routes',
    type: 'get',
    response: _ => {
      return {
        code: 20000,
        data: tableData
      }
    }
  },

  // mock get all roles form server
  {
    url: '/getUserList',
    type: 'get',
    response: _ => {
      return {
        code: 20000,
        data: tableData
      }
    }
  },

  // add role
  {
    url: '/role',
    type: 'post',
    response: {
      code: 20000,
      data: {
        key: Mock.mock('@integer(300, 5000)')
      }
    }
  },

  // update role
  {
    url: '/role/[A-Za-z0-9]',
    type: 'put',
    response: {
      code: 20000,
      data: {
        status: 'success'
      }
    }
  },

  // delete role
  {
    url: '/role/[A-Za-z0-9]',
    type: 'delete',
    response: {
      code: 20000,
      data: {
        status: 'success'
      }
    }
  }
]
